package com.zmx.b2c.pay.repository;

import com.zmx.b2c.pay.entity.Payment;
import com.zmx.common.common.repository.BaseRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @author zhaomxr
 */
public interface PaymentRepository extends BaseRepository<Payment> {

    List<Payment> findByOrders(Long orderId);

    @Query(value = "select * from payment where orders = ?1 order by create_time desc limit 1", nativeQuery = true)
    Payment findLastPaymentByOrderId(Long orderId);
}
